
*Sorting LER 1990 Data*

import excel using kydist_ler_1990.xlsx, firstrow clear

save kydist_ler_1990.dta, replace

joinby ncesid using kydistcntycrosswalk.dta, unmatched(master)

tab _merge

drop _merge

joinby ncesid using distenrollmentccd.dta, unmatched(master)
tab _merge

drop _merge

by countyfip, sort: egen cntyenroll=sum(enrollmentccd)

gen distenrollshare=enrollmentccd/cntyenroll

gen ler1990=distenrollshare*lerate

collapse (sum) ler1990, by(countyfip)

egen ler1990_pctile=xtile(ler1990) if countyfip!=., nq(100)

egen ler1990_quartile=xtile(ler1990) if countyfip!=., nq(4)

save cntyler1990.dta, replace
